package part_1;

public class Cards_2 {

	public static void main(String[] args) {
		while(true) {
			try {
				System.out.println("The number on the card is :" + getCard());
				break;
			} catch (CardExeption e) {
				System.out.println(e.getMessage());
			}
		}
	}
	
	public static int getCard() throws CardExeption{
		//initiate value
		int value;
		
		//Draw a card number
		//make a card
		value = (int) (Math.random()*13 + 1);
		//the card acceptable ?
		if (value < 7 && value != 1) {
			//if not throw error
			throw new CardExeption();
		}
			
		return value;
	}
}
